import { createRouter, createWebHashHistory } from "vue-router"

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      redirect: '/index',
      component: () => import('@/views/Layout.vue'),
      children: [
        {
          path: '/index',
          component: () => import('@/views/Index.vue')
        },
        {
          path: '/found',
          component: () => import('@/views/Found.vue')
        },
        {
          path: '/publish',
          component: () => import('@/views/Publish.vue')
        },
        {
          path: '/mine',
          component: () => import('@/views/Mine.vue')
        }
      ]
    },
    {
      path: '/search-travel',
      component: () => import('@/views/SearchTravel.vue')
    },
    {
      path: '/details-page',
      component: () => import('@/views/DetailsPage.vue')
    },
    {
      path: '/password-settings',
      component: () => import('@/views/PasswordSettings.vue')
    }
  ],
  scrollBehavior (to, from, savedPosition) {
    // return 期望滚动到哪个的位置
    return { top: 0 }
  }
})

export default router